#pragma once


#include <IXLabel.h>
#include "XFrameImpl.h"

#include "RichTextParser.h"

template <class I>
class CXLabelImpl : public CXFrameImpl<I>
{
    typedef CXFrameImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXLabel, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXLabel,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXLabelImpl, superclass, _T("Label"));

public:
    CXLabelImpl();
    virtual ~CXLabelImpl();

public:
    // IXLabel
    virtual void STDMETHODCALLTYPE    put_RichText(IN LPCTSTR szRichText);
    virtual HRESULT STDMETHODCALLTYPE get_RichText(OUT BSTR* pbstrRichText);

public:
    // IXFrame
    virtual void    STDMETHODCALLTYPE   Draw(XCANVAS xCanvas, const RECT& rcDraw);

public:
    // IXControl
    virtual void    STDMETHODCALLTYPE   GetAutoSize(OUT LPSIZE pAutoSize);
    virtual HRESULT STDMETHODCALLTYPE   put_Text(IN LPCTSTR szText);
    virtual void    STDMETHODCALLTYPE   put_MaxSize(int nWidth, int nHeight);

public:
    // IXBaseObj
    virtual void STDMETHODCALLTYPE   OnConstruct();

protected:
    // CXControlImpl
    virtual HRESULT OnSkinLangChanged();

protected:
    CRichTextParser     m_TextParser;
    XString             m_strRichText;
    XString             m_strRichTextResId;
    BOOL                m_bRichText;
};


class CXLabel : public CXLabelImpl<IXLabel>
{
};
